<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Type;
use App\Services\TypeService;
use Illuminate\Http\Request;

class TypeController extends Controller
{

    protected $TypeService;
    public function __construct(TypeService $TypeService)
    {
        $this->TypeService = $TypeService;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $title = $request->title;
        $model = $request->model;

        $sql = $this->TypeService->get($model,$title);
        $data = $sql->get();
        return response()->json(['code' => 200, 'message' => '操作成功','data'=>$data]);
    }
}
